//
//  Constants.h
//  BUBU3D
//
//  Created by lichentao on 14-7-5.
//  Copyright (c) 2014年 chentaoApp. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "BPCommon.h"

#define IOS_VERSION [[[UIDevice currentDevice] systemVersion] floatValue]

// 开发环境
//#define PATH_BASE @"http://localhost/xampp/yimei_api/index.php/"
/* 测试环境*/
#define PATH_BASE @"http://139.129.17.127/"

/* 生产环境 */
//#define PATH_BASE @"http://139.129.17.127/"
// test

#define HELLO @"hello"

// 定位
#define CITY_LIST               @"regions/get_city"
#define CITY_DETAIL             @"regions/get_city_detail"
// 参考发型
#define FAXING_CATEGORY         @"faxings/faxing_category"
#define FAXING_CATEGORY_LIST    @"faxings/category_list"

// 门店
#define STORE_LIST              @"stores/store_list"
#define STORE_PRODUCT_LIST      @"stores/detail"
#define STORE_DETAIL            @"stores/store_detail"

// 订单
#define ORDER_SUBMIT_INFO       @"orders/get_pay_info"
#define SUBMIT_ORDER            @"orders/submit_order"

// 用户
#define USER_INFO @"users/get_user_info"
#define USER_MODIFY_NAME @"users/modify_username"
#define USER_MODIFY_PWD @"users/modify_password"
#define USER_UPLOAD_IMG @"users/upload_head_icon"
#define USER_ABOUT_BP @"users/show_about"

//------------------------------------------------宏定义
#define kTabBarHeight 49.0f
#define KNavBarHeight 44.0f

#define SharedAppDelegate ((AppDelegate*)[[UIApplication sharedApplication] delegate])
#define ScreenWidth [UIScreen mainScreen].bounds.size.width
#define ScreenHeight [UIScreen mainScreen].bounds.size.height

/* iphone 5设备检测 */
#define ScreenSize (iPhone5 ? CGSizeMake(320, 548): CGSizeMake(320, 460))
#define iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)
#define iPhone6 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750, 1334), [[UIScreen mainScreen] currentMode].size) : NO)
#define iPhone6Plus ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2208), [[UIScreen mainScreen] currentMode].size) : NO)

/* 导航条左右按钮 */
// LEFT
#define BACK_BAR_BUTTON_BACK(SELECTOR) [UIBarButtonItem backBarButtonItemWithTarget:self action:SELECTOR forControlEvents:UIControlEventTouchUpInside]

#define BACK_BAR_BUTTON_TITLE(TITLE, SELECTOR) [UIBarButtonItem backBarButtonItemWithTitle:TITLE target:self action:SELECTOR forControlEvents:UIControlEventTouchUpInside]

#define BACK_BAR_BUTTON_IMAGE(IMAGE, SELECTOR) [UIBarButtonItem backBarButtonItemWithTitle:TITLE target:self action:SELECTOR forControlEvents:UIControlEventTouchUpInside]

// RIGHT
#define BAR_BUTTON_TITLE(TITLE, SELECTOR) [UIBarButtonItem rightBarButtonItemWithTitle:TITLE target:self action:SELECTOR forControlEvents:UIControlEventTouchUpInside]

#define BAR_BUTTON_IMAGE(image, SELECTOR) [UIBarButtonItem backBarButtonItemWithImage:image target:self action:SELECTOR forControlEvents:UIControlEventTouchUpInside]

// 数组数据越界检查
#define OBJECT_OF_ATINDEX(_ARRAY_,_INDEX_) ((_ARRAY_)&&[_ARRAY_ isKindOfClass:[NSArray class]]&&([_ARRAY_ count]>0)&&((_INDEX_) < [_ARRAY_ count])&&((_INDEX_) >= 0)?([_ARRAY_ objectAtIndex:(_INDEX_)]):(nil))//有返回值

// 正则表达式
#define REGEX_HTTPS @"https://([\\w-]+\\.)+[\\w-]+(/[\\w- ./?%&=]*)?" //http正则表达式
#define REGEX_HTTP @"http://([\\w-]+\\.)+[\\w-]+(/[\\w- ./?%&=]*)?" //http正则表达式
#define REGEX_TIME @"^((([0-1]?[0-9])|(2[0-3])):)?([0-5][0-9]):([0-5][0-9])$" //12:12:12时间正则表达式
#define REGEX_PHONENUMBER @"^((13[0-9])|(14[5-7])|(17[0-9])|(15[^4,\\D])|(18[0-9]))\\d{8}$"
#define REGEX_NUMBER @"^[0-9]*$"
#define REGEX_EMAIL @"^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$"
// 颜色宏定义
#define COLOR(color16) [BPCommon colorWithHexValue:color16 alpha:1.0f]
#define ORANGE_COLOR [BPCommon colorWithHexValue:0xfa962a alpha:1.0f]
#define LIGHT_GRAY_COLOR [BPCommon colorWithHexValue:0xeeeeee alpha:1.0f]
/*区域配送－城市*/
#define CITY_FIRST_LETTER	@"定热ABCDEFGHIJKLMNOPQRSTUVWXYZ"

//支付- 通知宏定义
#define SCHEME @"com.iphoneApp.master"
#define ALIXPAY_RESULT_NOTIFICATION @"ALIXPAY_RESULT_NOTIFICATION"


/* 控制log输出 */
//#ifdef SHOWLOG
//#define NSLog(fmt, ...) NSLog(fmt,##__VA_ARGS__);
//#else
//#define NSLog(fmt, ...)
//#endif

typedef enum
{
    Load_InitStyle,           // 初始化
	Load_MoreStyle,           // 加载更多
	Load_RefrshStyle          // 下拉刷新
} WallLoadStyle;

// 我的订单
typedef enum : int
{
    UnPay=1,
    HasPay,
    Finish,
    getAlready,
} MyOrderType;

// tableview是搜索还是列表状态
typedef enum{
    TABLEVIEW_SEARCH = 1,
    TABLEVIEW_LIST,
}TableViewStyle;

// 定位两种状态
typedef enum{
    Location_START = 1,
    Location_SUCESS,
    Location_FAIL,
    Location_NOEXSIT,
}LocationStyle;